﻿using System;
using fastCSharp;

namespace diantou.web.onlineJudge
{
    /// <summary>
    /// 提交记录
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class judgeStatus : view<judgeStatus>
    {
        /// <summary>
        /// 分页路径
        /// </summary>
        private static string pagePath = diantou.dataModel.path.pub.Default.OnlineJudgeStatusPath + "?";
        /// <summary>
        /// 用户与测试提交关系集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private userJudge[] judges;
        /// <summary>
        /// 更新版本
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        private int updateVersion;
        /// <summary>
        /// 分组菜单
        /// </summary>
        private groupMenu groupMenu
        {
            get { return new groupMenu { ViewOnly = requestHeader.IsReView }; }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="language"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        private bool loadView(diantou.dataModel.judgeState.languageType language, int page)
        {
            diantou.dataAccess.judge[] values = diantou.dataAccess.tcpCall.judge.get(language, pageInfo.Size = 20, pageInfo.Page = page, out pageInfo.Count, out updateVersion);
            bool isAdmin = currentUser != null && currentUser.Permission == dataModel.user.permission.Admin;
            judges = values.getArray(value => new userJudge { Judge = value, UserId = currentUserId, IsAdmin = isAdmin });
            if (language == dataModel.judgeState.languageType.All && requestHeader.IsSearchEngine) pageInfo.Path = pagePath;
            return true;
        }
    }
}
